#include "systick.h"

void SysTick_Delay_ms(uint32_t Nms)
{
	if(Nms>1864)Nms=1864;
	SysTick->CTRL=0;
	SysTick->LOAD=Nms*9000-1;
	SysTick->CTRL=0x01;
	
	while(!(SysTick->CTRL & (1u<<16)));
	SysTick->CTRL=0;
	SysTick->VAL=0;
}
void SysTick_Delay_us(uint32_t Nus)
{
	if(Nus>1864000)Nus=1864000;
	SysTick->CTRL=0;
	SysTick->LOAD=Nus * 72-1;
	SysTick->CTRL=0x05;
	
	while(!(SysTick->CTRL & (1<<16)));
	SysTick->CTRL=0;
	SysTick->VAL=0;
}
